<template>
  <div class="login-content">
    <!-- 左侧左侧部分 -->
    <div class="register">
      会员账户和注册用户可直接登录<br>
      如果没有账户，点击 <span @click="$router.push('/register/casualuser')">立即注册</span><br>
      正式会员可享受更多优惠及服务，<span @click="$router.push('/register/member')">加入</span>
    </div>
    <!-- 右侧登陆部分 -->
    <div class="login">
      <div class="login-qr-icon iconfont icon-computer" v-if="isweixin" @click="isweixin = !isweixin"></div>
      <div class="login-qr-icon iconfont icon-erweima" v-if="!isweixin" @click="isweixin = !isweixin"></div>
      <!-- 非微信登录 -->
      <div class="login-not-weixin" v-if="!isweixin">
        <div class="login-weixin-icon">
          <i class="iconfont icon-weixin"></i>
          <span>扫码登录</span>
        </div>
        <div class="login-header">
          <span :class="isusername ? 'login-header-span-active' : ''" @click="isusername = !isusername">账号登录</span>
          <span :class="isusername ? '' : 'login-header-span-active'" @click="isusername = !isusername">短信登录</span>
        </div>
        <div class="login-box">
          <!-- 用户名登录 -->
          <div class="login-user" v-if="isusername">
            <div class="input-container">
              <i class="iconfont icon-account-fill"></i>
              <input type="text" name="username">
            </div>
            <div class="input-container">
              <i class="iconfont icon-password"></i>
              <input type="text" name="username">
            </div>
            <p>错误</p>
            <button class="login-btn">登录</button>
          </div>
          <!-- 电话登录 -->
          <div class="login-plone" v-if="!isusername">
            <div class="input-container">
              <i class="iconfont icon-phone-iphone"></i>
              <input type="text" name="phone">
            </div>
            <div class="input-container">
              <Slide :slideLineHeight='38' />
            </div>
            <div class="input-container">
              <i class="iconfont icon-anquan"></i>
              <input type="text" name="verificationcode">
            </div>
            <p>错误</p>
            <button class="login-btn">登录</button>
          </div>
        </div>
      </div>
      <!-- 微信登录 -->
      <div class="login-weixin" v-if="isweixin">
        <div class="login-weixin-title">微信登录</div>
        <div class="login-qr-box">
          <div class="login-qr-code"></div>
          <div class="login-qr-info">
            <p>请使用微信扫描二维码登录</p>
            <p>“会员系统”</p>
          </div>
        </div>
      </div>
      <div class="login-footer">
        <div class="footer-span-container" @click="$router.push('/register/member')">
          <i class="iconfont icon-add-fill"></i>
          <span>加入</span>
        </div>
        <div class="footer-span-container" @click="$router.push('/register/casualuser')">
          <i class="iconfont icon-add-account1"></i>
          <span>立即注册</span>
        </div>
        <div class="footer-span-container" @click="$router.push('/login/password')">
          <i class="iconfont icon-unlock-fill"></i>
          <span>忘记密码</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Slide from '@/components/Slide'

export default {
  name: 'Enter',
  data() {
    return {
      isweixin: false, // 是否为微信登录
      isusername: true, // 是否为账号登录
    }
  },
  components: {
    Slide,
  },
}
</script>

<style lang='less' scoped>
.login-content {
  position: absolute;
  width: 1200px;
  display: flex;
  justify-content: space-between;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);

  .register {
    line-height: 64px;
    font-size: 32px;
    color: #fff;
    font-weight: bold;
    cursor: default;
    margin: auto 0;

    span {
      font-size: 50px;
      font-weight: bold;
      color: #ebb600;
      cursor: pointer;
    }
  }

  .login {
    width: 400px;
    background-color: #fff;
    border-radius: 6px;
    padding: 8px 24px 25px;

    .login-qr-icon {
      position: absolute;
      right: 8px;
      top: 8px;
      width: 51px;
      height: 51px;
      font-size: 51px;
      color: #61667c;

      &::after {
        content: '';
        width: 0;
        display: block;
        position: absolute;
        top: 2px;
        left: -2px;
        border: 25.5px solid #fff;
        border-right-color: transparent;
        border-top-color: transparent;
      }
    }

    .login-not-weixin {
      .login-weixin-icon {
        margin-left: 185px;
        width: 110px;
        height: 24px;
        border: 1px solid #ccc;
        border-right: transparent;
        border-radius: 6px 0 0 6px;
        line-height: 24px;
        text-align: center;

        i {
          color: green;
          margin-right: 6px;
        }

        span {
          color: #a7a7a7;
          cursor: default;
        }
      }

      .login-header {
        margin-top: 14px;

        span {
          display: inline-block;
          font-size: 20px;
          padding-bottom: 6px;
          color: #a1a6bb;
          font-weight: bold;
          cursor: pointer;

          &:first-child {
            margin-right: 20px;
          }
        }

        .login-header-span-active {
          border-bottom: 2px solid #0047ae;
          color: #0047ae;
        }
      }

      .login-box {
        margin-top: 24px;

        .input-container {
          position: relative;
          margin-bottom: 15px;
          height: 46px;

          input {
            width: 100%;
            line-height: 44px;
            padding-left: 55px;
            border-radius: 6px;
            border: 1px solid #eee;
            font-size: 16px;
            color: #333;
            background-color: #fff;
            outline: none;
          }

          i {
            position: absolute;
            font-size: 30px;
            background-color: #c9d0dd;
            width: 44px;
            line-height: 44px;
            text-align: center;
            border-radius: 6px 0 0 6px;
            color: #fff;
          }
        }

        p {
          font-size: 16px;
          color: #c3000a;
        }

        .login-btn {
          width: 100%;
          margin-bottom: 20px;
          line-height: 48px;
          text-align: center;
          border-radius: 6px;
          background-color: #0047ae;
          color: #fff;
          font-size: 18px;
          font-weight: bold;
          cursor: pointer;
        }
      }
    }

    .login-weixin {
      padding: 20px;

      .login-weixin-title {
        text-align: center;
        line-height: 32px;
        font-size: 20px;
      }

      .login-qr-box {
        .login-qr-code {
          width: 180px;
          height: 180px;
          border: 1px solid #ccc;
          margin: 0 auto;
          margin-top: 20px;
        }

        .login-qr-info {
          padding: 7px 14px;

          p {
            text-align: center;
          }
        }
      }
    }

    .login-footer {
      width: 100%;
      height: 26px;
      display: flex;
      justify-content: space-between;

      .footer-span-container {
        cursor: pointer;

        span {
          font-size: 16px;
          color: #333;
          line-height: 26px;
        }

        i {
          font-size: 24px;
          vertical-align: -3.5px;
          margin-right: 5px;
        }

        &:first-child {
          i {
            font-size: 26px;
            vertical-align: -3px;
            color: #1babea;
          }
        }

        &:nth-child(2) {
          i {
            color: #0047ae;
          }
        }

        &:last-child {
          i {
            color: #e52731;
          }
        }
      }
    }
  }
}
</style>